package com.estronger.shopmanage.base;

import android.view.View;

import com.estronger.shopmanage.manager.NetManager;

public abstract class BaseHolder<Data> {
	private View contentView;
	protected Data data;

	public BaseHolder() {
		contentView = initView();
		contentView.setTag(this);
	}

	public abstract View initView();

	public View getContentView() {
		return contentView;
	}

	public void setData(Data data) {
		this.data = data;
		refreshView(data);
	}

	public abstract void refreshView(Data data);

	// 为子类准备的一个联网类，这里完全应该移动到BaseFragment里面去做处理
	protected NetManager netManager = new NetManager() {
		@Override
		public void onNetWorkSuccess(int code, String result) {
			onNetSuccess(code, result);
		}

		@Override
		public void onNetWorkErorr(int code, String result) {
			onNetErorr(code, result);
		}
	};

	protected void onNetSuccess(int code, String result) {
	}

	protected void onNetErorr(int code, String result) {
	}

}
